﻿package cz.dadul.adventure.asset
{
	/**
	 * ...
	 * @author Dadul
	 */
	import flash.display.*;
	public class Boundary extends Sprite
	{
		
		public function Boundary() 
		{
			
		}
				
		public function hitTestObject2 (obj:DisplayObject) : Boolean {
			var collisionObj:DisplayObject = obj;
			// Check special hitArea for Players
			if ((obj is Player)) {
				var obj2:Player = obj as Player;				
				var co:DisplayObject = obj2.hitArea;
				if (co) {				
					collisionObj = co;				
				}
			}
			
			for (var i:int = 0; i < this.numChildren; i++) {					
				//if (this.getChildAt(i).hitTestObject(collisionObj)) return true;						
				if (collisionObj.hitTestObject(this.getChildAt(i))) return true;						
			}
			
			return false;			
		}
		
		public function addConstraint(shape:Sprite):void {
			this.addChild(shape);
		}
		
	}

}